//业务接口封装
import { get, post, put, deletes } from '../utils/http'
//登录接口
export const loginAdmin = paramas => {
  return post('/admin/login', paramas);
}

//后台用户模块
export const getAllUser = paramas => {
  return get('/admin/users', paramas);
}
export const addUser = paramas => {
  return post('/admin/user', paramas);
}
//编辑用户
export const userEdit = (params) => {
  return put('/admin/user', params)
  // 参数{
  //   username:'',
  //   email:'',
  //   status:,
  //   userld:,
  // }
}
//删除用户
export const userDelete = paramas => {
  return deletes('/admin/user', paramas);
}
//搜索用户
export const userSearch = params => {
  // {username:''}
  return get('/admin/user/search', params)
}
// ---------------分类----------------
export const getClassfy = () => {
  return get('/admin/classes')
}
// ---------------菜单----------------
export const getMenu = () => {
  return get('/admin/menus')
}
// -----------------文章----------------
export const getArtical = params => {
  return get('admin/articals', params)
}
export const addArtical = params => {
  return post('admin/artical', params)
}
export const getOneArtical = params => {
  return get(`/admin/artical/${params}`)
}
export const editArtical = params => {
  return put('/admin/artical', params)
}
export const deleteArtical = params => {
  return deletes('/admin/artical', params)
}
// ----------------轮播图-------------
export const getBanner = () => {
  return get('/admin/banners')
}
// 添加
export const addBanner = params => {
  return post('/admin/banner', params)
}
//删除
export const deleteBanner = params => {
  return deletes('/admin/banner', params)
}
//编辑
export const editBanner = (params) => {
  return put('/admin/banner', params)
  // 参数{
  //   username:'',
  //   email:'',
  //   status:,
  //   userld:,
  // }
}

